<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	<link rel="stylesheet" href="../../css/bootstrap.min.css" />
	<title><h:outputText value="NP Pillar" /></title>
</h:head>
<h:body>

	<ui:insert name="header">
		<ui:include src="../template/header.xhtml" />
	</ui:insert>
	<h:form id="mainForm">
		<p:panel header="#{competencyControler.editMode ? 'Edit Competency' : 'Add Competency'}">
			<p:messages id="messages" closable="true" />
			<p:panelGrid columns="2">
				<p:outputLabel value="Name" for="name" />
				<p:inputText id="name" value="#{competencyControler.editDto.name}" required="true" requiredMessage="Competency Name is required."
					validator="#{competencyControler.nameValidate}" />

				<p:outputLabel value="Description" />
				<p:outputPanel>
					<p:inputTextarea value="#{competencyControler.editDto.description}"
						rows="5" cols="30" counter="desDisplay" maxlength="200"
						counterTemplate="{0} characters remaining." autoResize="false"
						style="display:block" />
					<h:outputText id="desDisplay" />
				</p:outputPanel>

			</p:panelGrid>
			<p:commandButton value="Save"
				actionListener="#{competencyControler.apply}" update="messages"
				action="#{mainMenuControler.transfer}" onclick="blockui.show()" oncomplete="blockui.hide()">
				<f:setPropertyActionListener target="#{mainMenuControler.nextMenu}"
					value="/faces/admin/competency.jsf" />
			</p:commandButton>
			<p:commandButton value="Cancel"
				actionListener="#{competencyControler.clear}" immediate="true"
				action="#{mainMenuControler.transfer}" onclick="blockui.show()">
				<f:setPropertyActionListener target="#{mainMenuControler.nextMenu}"
					value="/faces/admin/competency.jsf" />
			</p:commandButton>
		</p:panel>
	</h:form>
</h:body>
</html>
